package com.sttk.secreconeclick.bookkeep.adapter;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.lzb.basic.ProviderMultiAdapter;
import com.sttk.secreconeclick.bookkeep.R;
import com.sttk.secreconeclick.bookkeep.bean.BillTypeBean;

public class SelTypeAdapter extends ProviderMultiAdapter<BillTypeBean> {

    public SelTypeAdapter() {
        addItemProvider(new SelTypeProvider());
    }

    private class SelTypeProvider extends BaseItemProvider<BillTypeBean> {
        @Override
        public int getItemViewType() {
            return ProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_sel_type;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, BillTypeBean bean) {
            baseViewHolder.setImageResource(R.id.ivSelTypeItemImg, bean.getIcon());
            baseViewHolder.setText(R.id.tvSelTypeItemName, bean.getName());
            if (bean.isSelected()) {
                baseViewHolder.setImageResource(R.id.ivSelTypeItemSel, R.drawable.select2);
            } else {
                baseViewHolder.setImageResource(R.id.ivSelTypeItemSel, R.drawable.noselect);
            }
        }
    }
}